<script language="javascript">
$(document).ready(function() {
   
    $("#namhoc").change(function(){
        
        var namhoc = $("#namhoc option:selected").text();
        var url=window.location.pathname;
        var num=url.lastIndexOf('/')+1;
        var chidoanid=url.substring(num);
        var namhocht="<?php echo $phanloaisinhviens[0]['Z1phanloaisinhvien']['namhoc'];?>";
        //if(hocky!=hockyht){
            if(namhocht!=namhoc){ 
                $('#thongke').load( 
                       "../thongke/" + namhoc + "/"+chidoanid
                       , function () {                         
                        $(this).show();
                        $("#duyetpl").hide();
                       }); 
                   
            }else{
                $('#thongke').hide();
                $("#duyetpl").show();   
            }
    })            
            
        //}
        

        
    
});
</script>
<ul id="navlist">
        <li id="current"><?php echo $this->Html->link(__('Duyệt phân loại đoàn viên', true), array('action' => 'danhsachcd')); ?></li>
        <li><?php echo $this->Html->link(__('Duyệt đoàn viên ưu tú', true), array('controller'=>'dvutsvs','action' => 'danhsachcd')); ?></li>
</ul>
<div class="Phanloaisinhviens index">
<h2><?php __('Phân loại đoàn viên năm học '.$phanloaisinhviens[0]['Z1phanloaisinhvien']['namhoc']);?></h2>
<?php 
    $index = array_search($phanloaisinhviens[0]['Z1phanloaisinhvien']['namhoc'],$namhocs);
    echo $this->Form->input('hocky',array('type'=>'select','label'=>'Xem kết quả pldv của từng học kỳ','options'=>$namhocs,'default'=>$index,'id'=>'namhoc'));
?>
<h2><?php __('Chi đoàn: '.$chidoan['Chidoansv']['tenchidoan'].' ('.$chidoan['Chidoansv']['machidoansv'].')');?></h2>
    <div id="thongke"></div>
<div id="duyetpl">    
<h2><?php __('Duyệt phân loại đoàn viên năm học '.$phanloaisinhviens[0]['Z1phanloaisinhvien']['namhoc']);?></h2>
<?php if(!empty($phanloaisinhviens)):?> 
    <?php 
        if(count($phanloaisinhviens)>0){
            echo "Xuất sắc: ".$tlxs.'%';
            echo "Khá: ".$tlk.'%';
            echo "Trung bình: ".$tltb.'%';
            echo "Yếu: ".$tly.'%';
            foreach($loaicdsinhvien as $xeploaicd){
             if($loaicd==$xeploaicd['Xeploaicd']['id']) echo "<div>Xếp loại chi đoàn: ".$xeploaicd['Xeploaicd']['loaicd']."</div>";   
            }
        }else {
            echo "Chưa phân loại sinh viên!";
        }
        
    ?>
    <?php echo $this->Form->create('Phanloaisinhvien',array('action'=>'duyet'));?>
    <?php echo $this->Form->input('chidoan_id', array('type'=>'hidden','value'=>$chidoan['Chidoansv']['id']));?>
	<table cellpadding="0" cellspacing="0">
    <tr>    
            <th><?php  __('STT');?></th>
            <th><?php 
                    echo $this->Form->checkbox('all',array('id'=>'checkallduyet')) ;
                    __('Đã duyệt');
            ?></th>
            <th><?php 
                    echo $this->Form->checkbox('all',array('id'=>'checkallchuaduyet')) ;
                    __('Chưa duyệt');
            ?></th>
			<th><?php  __('Xếp loại');?></th>
			<th><?php __('MSSV');?></th>
			<th><?php __('Họ Tên');?></th>
            <th><?php __('Điểm RL');?></th>
            <th><?php __('Điểm TBHK');?></th>
            <th><?php //__('Số phong trào sinh viên');?></th>
            <th><?php //__('Số phong trào khoa');?></th>
            <th><?php __('Ghi chú');?></th>
            
			<!--removed <th class="actions"><?php __('Actions');?></th>-->
            
	</tr>
	<?php
	$i = 0;
    $j=1;    
	foreach ($phanloaisinhviens as $phanloaisinhvien):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
        <td><?php echo $i;?></td> 
        <td><?php if($phanloaisinhvien['Z1phanloaisinhvien']['duyet']==0) echo $this->Form->checkbox('Phanloaisinhvien.duyet.'.$phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'],array('class'=>'duyet')); else echo "Đã duyệt";?></td>
        <td><?php if($phanloaisinhvien['Z1phanloaisinhvien']['duyet']==1) echo $this->Form->checkbox('Phanloaisinhvien.chuaduyet.'.$phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'],array('class'=>'chuaduyet')); else echo "Chưa duyệt";?></td>   
		<td>
			<?php 
                foreach($xeploais as $xeploai)
                if($xeploai['Xeploai']['id']==$phanloaisinhvien['Z1phanloaisinhvien']['xeploai_id'])echo $xeploai['Xeploai']['tenloai'];//echo $form->input('xeploai_id'.$j,array('type'=>'select','label'=>'','options'=>$xeploais,'default'=>$phanloaisinhvien['Z1phanloaisinhvien']['xeploai_id'])); 
            ?>
		</td>
        <td><?php echo $phanloaisinhvien['Z1phanloaisinhvien']['mssv']; ?></td>
        <td><?php echo $phanloaisinhvien['Z1phanloaisinhvien']['hoten']; ?></td>
		<td><?php echo $phanloaisinhvien['Z1phanloaisinhvien']['diemrenluyen']; ?>&nbsp;</td>
		<td><?php echo $phanloaisinhvien['Z1phanloaisinhvien']['diemtbhk']; ?>&nbsp;</td>
        <td><?php //echo $this->Html->link(__($phanloaisinhvien['Z1phanloaisinhvien']['slcd'], true), array('controller'=>'thanhtichsvs','action' => 'viewtt', $phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'])); ?>&nbsp;</td>
        <td><?php //echo $this->Html->link(__($phanloaisinhvien['Z1phanloaisinhvien']['slkhoa'], true), array('controller'=>'thanhtichkhoasvs','action' => 'viewtt', $phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'])); ?>&nbsp;</td>
        <td><?php echo $phanloaisinhvien['Z1phanloaisinhvien']['ghichu']; ?>&nbsp;</td>
        <!-- Removed
		<td class="actions">        
			<?php echo $this->Html->link(__('View', true), array('action' => 'view', $phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'])); ?>
			<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'])); ?>
			<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $phanloaisinhvien['Z1phanloaisinhvien']['sinhvien_id'])); ?>
		</td>
        -->
	</tr>
    <?php $j++;?>
<?php endforeach; ?>
	</table>
    <?php
     echo $this->Form->end('Lưu');
    ?>
<?php else:?>
    <?php echo "Không có dữ liệu";?>
<?php endif;?>
<div class="dvutsvs index">
<?php if(!empty($dvutsvs)):?>        
	<h2><?php __('Danh sách đoàn viên ưu tú đã được bình xét');?></h2>
    <h2><?php __('Chi đoàn: '.$chidoan['Chidoansv']['tenchidoan'].' ('.$chidoan['Chidoansv']['machidoansv'].')');?></h2>
	<?php echo "Học kỳ: ".$hockyht['Hocky']['tenhocky']; ?>
    <?php echo $this->Form->create('Dvutsv',array('action'=>'duyet'));?>
    <?php echo $this->Form->input('chidoan_id',array('type'=>'hidden','value'=>$chidoan['Chidoansv']['id']));?>
	<table cellpadding="0" cellspacing="0">
	<tr>
            <th><?php __('STT');?></th>
            <th>
                <?php 
                echo $this->Form->checkbox('all',array('id'=>'checkallduyet')) ;
                __('Đã Duyệt');
                ?>
            </th>
            <th>
                <?php 
                echo $this->Form->checkbox('all',array('id'=>'checkallchuaduyet')) ;
                __('Chưa duyệt');
                ?>
            </th>
			<th><?php __('MSSV');?></th>
            <th><?php __('Họ tên');?></th>
			<th><?php __('Số người đồng ý');?></th>
			<th><?php __('Ghi chú');?></th>            
            <th><?php __('Action');?></th>
	</tr>
	<?php
	$i = 0;
    $j=1;
	foreach ($dvutsvs as $dvutsv):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
        <td>
            <?php echo $i ;?>
        </td>
        <td><?php if($dvutsv['Z1dvutsv']['duyet']==0) echo $this->Form->checkbox('Dvutsv.duyet.'.$dvutsv['Z1dvutsv']['id'],array('class'=>'duyet')); else echo "Đã duyệt";?></td>
        <td><?php if($dvutsv['Z1dvutsv']['duyet']==1) echo $this->Form->checkbox('Dvutsv.chuaduyet.'.$dvutsv['Z1dvutsv']['id'],array('class'=>'chuaduyet')); else echo "Chưa duyệt";?></td>
        <td>
            <?php echo $dvutsv['Z1dvutsv']['mssv'];?>
        </td>
        <td>
            <?php echo $dvutsv['Z1dvutsv']['hoten'];?>
        </td>
		<td><?php echo $dvutsv['Z1dvutsv']['songuoidongy'].'/'.$dvutsv['Z1dvutsv']['songuoithamgiabau'];?>&nbsp;</td>
        <td>
            <?php echo $dvutsv['Z1dvutsv']['ghichu'];?>
        </td>
        <td class="actions">        
            <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $dvutsv['Z1dvutsv']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $dvutsv['Z1dvutsv']['mssv'])); ?>
		</td>		
	</tr>
    <?php $j++;?>
<?php endforeach; ?>
	</table>
     <?php
     echo $this->Form->end('Lưu');
    ?>
<?php else:?>
    <?php echo "Chưa bình xét đoàn viên ưu tú!";?>
<?php endif;?>        
</div>
   
</div
</div>